-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CUT-4344: Forget WiFi Network Command #613
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few items needed work, not sure if it was working when you tested some hello world script but I think (after more than an hour troubleshooting), it didn't execute the script unless the quotes were straight quotes. I'm not postive there.
The remove-wifi script needs a few changes to account for networks with spaces and also there was one missing backtick which broke the script from functioning in the first place.
After making these changes:
- signing into a radius network
- changing the user's password with the JumpCloud tray app,
- clicking "disconnect network"
- clicking "connect to network" with the "Remember this Network" option selected
- The network failed to connect the first time
- The scheduled task ran and then "forgot" the network
- I was able to click the network name and enter my new credentials which allowed me to connect to the network.
After addressing the items suggested, task scheduler will report that the script finished with exit code 0
Before fixing any of the items I've suggested, Task Scheduler will report some script finished with this exit code (non-zero)
) | ||
Begin { | ||
`$list = ((netsh.exe wlan show profiles) -match '\s{2,}:\s') -replace '.*:\s' , '' | ||
`$ProfileList = `$List | Foreach-object { [pscustomobject]@{Name = $_ } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this
PowerShell/JumpCloud Commands Gallery/Windows Commands/Windows - Forget RADIUS WiFi Network.md
Outdated
Show resolved
Hide resolved
</Triggers> | ||
<Actions Context="Author"> | ||
<Exec> | ||
<Command>“C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe”</Command> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Command>“C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe”</Command> | |
<Command>"C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"</Command> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed these, I didn't have an issue with the XML with the original quotes, but I updated just in case
<Actions Context="Author"> | ||
<Exec> | ||
<Command>“C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe”</Command> | ||
<Arguments>-ExecutionPolicy ByPass -File “C:\scripts\removeWifi.ps1”</Arguments> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Arguments>-ExecutionPolicy ByPass -File “C:\scripts\removeWifi.ps1”</Arguments> | |
<Arguments>-ExecutionPolicy ByPass -File "C:\scripts\removeWifi.ps1"</Arguments> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not positive but I think the quotes were messing this up initially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed these, I didn't have an issue with the XML with the original quotes, but I updated just in case
} | ||
} else { | ||
# Save the removeWifi.ps1 file to C:\scripts\removeWifi.ps1 | ||
if (!Test-Path -Path C:\scripts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be potentially better to write If (-Not (Test-Path -Path "C:\scripts"))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise I have no idea why the command result threw that error initially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was supposed to be (!(Test-Path -Path C:\scripts)), fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works perfect after those changes! @kmaranionjc, since you don't have a radius network to test, here's what I'd expect to see you validate:
- Run the script from command console
- The script should run successfully on a windows device
- The string you specified in the command for the
$RadiusSSID
variable should be set at the bottom of the script body.
I've validated the network disconnect functionality so if there's an issue it can come back to me but thanks for this Geoff awesome to see us have this as a template, this really cool work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issues
What does this solve?
Creates a new Command template that should resolve the issue for customers using Radius and a user changes their password after connecting to a network and being unable to reconnect.
Is there anything particularly tricky?
Testing involves having RADIUS configured
How should this be tested?
i. Command results should not indicate a failure
ii. Validate that the scheduled task has been created via the task scheduler GUI and validate the PowerShell script exists in C:\scripts
Screenshots